<template>
  <div v-if="data._isInit">
    <el-collapse-item :title="$t('基础配置')" name="1">
      <el-form-item :label="$t('标题')">
        <el-input v-model="config.title"></el-input>
      </el-form-item>
    </el-collapse-item>
    <el-collapse-item :title="$t('数据配置')" name="2">
      <el-form-item :label="$t('数据视图')">
        <l-dbsource-select
          v-model="config.dataCode"
          @change="handleDataSourceChange"
          @init="handleDataSourceInit"
        />
      </el-form-item>
      <el-form-item :label="$t('指标')">
        <l-select v-model="config.valueKey" :options="fieldOptions" />
      </el-form-item>
    </el-collapse-item>
  </div>
</template>
<script>
import configMixins from "../mixins/config";
export default {
  mixins: [configMixins()],
  data() {
    return {};
  },
  methods: {
    init(data) {
      const config = {
        echarts: {
          series: {
            gauge: {},
          },
        },
        // 数据配置
        dataCode: "",
        valueKey: "",
      };
      this.commonInit(data, config);
    },
    clearKeys() {
      this.config.valueKey = "";
    },
  },
};
</script>

